package com.ht.module.ai.config;


import java.util.Map;
import com.ht.util.DateUtil;
import org.springframework.stereotype.Component;
import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class WeatherTools {
    @Tool("返回今日指定城市的天气情况")
    public String getWeather(@P("需要返回天气情况的城市") String city) {
        log.info("🔧 调用了 getWeather(city): {}", city);
        Map<String, String> weatherData = Map.of(
                "北京", "晴，25℃",
                "上海", "多云，28℃",
                "广州", "阵雨，30℃",
                "成都", "阵雨，25℃"
        );
        return weatherData.getOrDefault(city, "未知城市");
    }


    @Tool("获取当前时间")
    public String getDate() {
        log.info("🔧 调用了 getDate()");
        return DateUtil.getTime();
    }
}

